/**
 * 
 */
package cn.ad.server.web.servlet.v2.parser;

import cn.ad.server.web.spring.model.IAdserverRequest;
import cn.ad.server.web.spring.model.IAdserverResponse;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 通过httpservlet访问传递接的解释接口
 * @author Wu Chengjun
 */
public interface HttpServletParser {
	
	/**
	 * 从HttpServletRequest解析出广告请求数据
	 * @param request
	 * @return
	 */
	IAdserverRequest parse(HttpServletRequest request) throws AdRequestParseException;

	/**
	 * 写入广告响应对象到HttpServletResponse中
	 * @param adResponse
	 * @param response
	 * @throws AdRequestParseException
	 */
	void writeResponse(IAdserverResponse adResponse, HttpServletResponse response)  throws AdRequestParseException;
	
	
	/**
	 * 写入广告响应对象到HttpServletResponse中
	 * @param adRequest 广告请求
	 * @param adResponse 广告响应
	 * @param request Servlet请求
	 * @param response Servlet响应
	 * @throws AdRequestParseException
	 */
	void writeResponse(IAdserverRequest adRequest, IAdserverResponse adResponse, HttpServletRequest request, HttpServletResponse response)  throws AdRequestParseException;
}
